import React, { useEffect, useState } from "react";
import instance from "../../api/request";
import { useParams } from "react-router-dom";
import { NavBar, Space, Toast } from "antd-mobile";
import styles from "./Index.module.css";
import { useNavigate } from "react-router-dom";
import dayjs from "dayjs";
function Index() {
  const nav = useNavigate();
  const [detail, setDetail] = useState([]);
  const { infoId } = useParams();

  const getxiang = () => {
    instance
      .get("/api/share/information/v1/findInformation", {
        params: {
          infoId: infoId,
        },
      })
      .then((res) => {
        console.log(res);
        setDetail(res.data.result);
      });
  };

  useEffect(() => {
    getxiang();
  }, [infoId]);

  return (
    <div className={styles.xiang}>
      <div>
        <NavBar onBack={() => nav(-1)}>咨询详情</NavBar>
      </div>

      <div className={styles.xiangnei}>
        <h2 className={styles.title}>{detail.title}</h2>
        <div className={styles.di}>
          <span>{detail.source}</span>
          <span>{dayjs(detail.createTime).format("YYYY-MM-DD hh:mm:ss")}</span>
        </div>

        <div style={{marginTop:'11px'}} dangerouslySetInnerHTML={{ __html: detail.content }}>
        </div>
      </div>

    </div>
  );
}

export default Index;
